/*
 * @Description:String
 * 
 * @Author: rendc
 * 
 * @Date: 2025-08-07 14:31:29
 * 
 * @LastEditors: rendc
 * 
 * @LastEditTime: 2025-08-07 15:05:52
 */
public class TestString {

  public static void main(String[] args) {
    // String s1 = new String("123");
    // System.out.println(s1);
    // s1 = "345";
    // System.out.println(s1.toString());
    // String s2 = new String();
    // s2 = "789";
    // System.out.println("s2:" + s2);
    // char[] c = { 'h', 'e', 'l', 'l', 'o' };
    // String s3 = new String(c);
    // System.out.println("s3:" + s3);
    System.out.println("--==--==--==--");
    String str1 = "Hello";
    String str2 = "Hello";
    System.out.println(str1 == str2); // true

    String str3 = new String("world");
    String str4 = new String("world");
    System.out.println(str3 == str4); // false

    String str5 = new String("!").intern();
    String str6 = new String("!").intern();
    System.out.println(str5 == str6); // true

    String str7 = new String(",").intern();
    String str8 = new String(",");
    System.out.println(str7 == str8); // false

    String str9 = new String("。").intern();
    String str10 = "。";
    System.out.println(str9 == str10); // true
    //
    System.out.println("--==--==--==--");

    String s1 = "a";
    String s2 = "b";
    String s3 = "ab";
    String s4 = "a" + "b";
    String s5 = s1 + s2;
    System.out.println(s3 == s4); // true
    System.out.println(s3 == s5); // false
    System.out.println(s4 == s5); // false
    String s6 = (s1 + s2).intern();
    System.out.println(s4 == s6); // true

  }
}